<%@page import="com.apexedu.framework.util.SysPropertiesUtil" %>
<%@ page import="com.apexedu.identity.security.CasLoginUtil" %>
<%@ page import="com.apexedu.portal.constant.Constants" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Random" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%

    /*String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";*/
    request.setAttribute("basePath", request.getContextPath());

    Random rand = new Random();

    String casServerLogoutUrl = CasLoginUtil.getCasServerLogoutUrl();
    request.setAttribute("casServerLogoutUrl", casServerLogoutUrl);

    boolean isSsoEnabled = CasLoginUtil.isSsoEnabled();
    request.setAttribute("isSsoEnabled", isSsoEnabled);
%>
<html>
<head>
    <%-- <base href="<%=request.getAttribute("basePath")+"/"%>" /> --%>
    <title>苏州高等职业技术学校</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,12,11,10,9,8"/>
    <link rel="stylesheet" href="${basePath}/resources/ui/bootstrap/bootstrap.css"/>
    <link rel="stylesheet" href="${basePath}/resources/ui/bootstrap-table/bootstrap-table.css/"/>
    <link rel="stylesheet" href="${basePath}/resources/index/index.css"/>

    <script type="text/javascript" src="${basePath}/resources/ui/js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="${basePath}/resources/ui/bootstrap/bootstrap.min.js"></script>
    <script type="text/javascript" src="${basePath}/resources/ui/bootstrap-table/bootstrap-table.js"></script>
    <script type="text/javascript" src="${basePath}/resources/ui/bootstrap-table/bootstrap-table-export.js"></script>
    <script type="text/javascript" src="${basePath}/resources/ui/bootstrap-table/tableExport/jquery.base64.js"></script>
    <script type="text/javascript" src="${basePath}/resources/ui/bootstrap-table/tableExport/tableExport.js"></script>
    <script type="text/javascript" src="${basePath}/resources/ui/bootstrap-table/bootstrap-table-zh-CN.js"></script>
    <script type="text/javascript">
        $(function () {
            $("[data-toggle='popover']").popover();
            $("#userOpt").popover({
                trigger: "manual",
                placement: "bottom",
                html: true,
                content: function () {
                    var html = $(".headMenu").html();
                    console.log(html);
                    return html;
                }
            }).on("mouseenter", function () {
                var _this = this;
                $(this).popover("show");
                $(this).siblings(".popover").on("mouseleave", function () {
                    $(_this).popover('hide');
                });
            }).on("mouseleave", function () {
                var _this = this;
                setTimeout(function () {
                    if (!$(".popover:hover").length) {
                        $(_this).popover("hide")
                    }
                }, 1000);
            });
//            $.get("http://www.szhvs.com/notice/page_size/20/page/1", function (data, status) {
//                if (data.data.length > 0) {
//                    data.data.forEach(function (item, index, array) {
//                        var li = $("<li><a target='_blank' href='" + item.url + "'>" + item.title + "</a></li>");
//                        $("#notices").append(li);
//                    });
//
//                }
//
//            });
            $.get("http://www.szhvs.com/notice/page_size/1000/page/1", function (data, status) {
                $('#notices').bootstrapTable({
                    sidePagination: "client",
                    //是否显示分页（*）
                    pagination: true,
                    pageSize: 5,
                    //可供选择的每页的行数（*）
                    pageList: [5],
                    cache: false,
                    striped: true,                      //是否显示行间隔色
                    data: data.data,
                    columns: [
                        {
                            field: "title",
                            title: "名称",
                            halign: "center",
                            align: "left",
                            formatter: function (value, row, index) {
                                value = "<a target='_blank' href='" + row.url + "'>" + value + "</a>"
                                return value;
                            }
                        }, {
                            field: "source",
                            title: "来源",
                            align: "center"
                        }, {
                            field: "create_time",
                            title: "发布日期",
                            align: "center",
                            formatter: function (value, row, index) {
                                var newDate = new Date();
                                newDate.setTime(value * 1000);
                                return newDate.toLocaleDateString();
                            }
                        }]
                });
            });
        });
        var basePath = '${basePath}';
        var isSsoEnabled = ${isSsoEnabled};
        function execLogout() {
            <%if (CasLoginUtil.isSsoEnabled()) {
                // 通知业务系统liveBos登出。
                // 这里的地址是根据项目现场业务系统地址在门户管理后台的系统参数维护里修改。参数名用“livebos.urls”
                String liveBosUrl = SysPropertiesUtil.get("livebos.urls");
                if (null != liveBosUrl && !"".equals(liveBosUrl)) {
                    String[] liveBosUrls = liveBosUrl.split(",");
                    for (String url : liveBosUrls) {
                        out.println("$(\"<iframe src='" + url
                                + "/logout.do' height='0' frameborder='0'/>\").appendTo(\"body\");");
                    }
                }
            }%>

            var curTime = new Date().getTime();
            $.get("${basePath}/identity/ajaxlogin.action?act=logout", {q: curTime}, function (data) {
                data = eval("(" + data + ")");
                if (data.msg == 'success') {
                    if (isSsoEnabled) {
                        window.location.href = '${casServerLogoutUrl}';
                    } else {
                        window.location.href = "${basePath}" + "?t=" + Math.round(new Date().getTime() / 1000);
                    }
                } else {
                    alert(data.msg);
                }
            });
        }
    </script>
</head>
<body>
<div class="header">
    <div class="container clearfix">
        <div class="logo">
            <img src="${basePath}/resources/index/img/9.png">
        </div>
        <div class="login">
            <div style="float:left;">
                <img src="${basePath}/resources/index/img/8_left.png">
            </div>
            <div style="float:left; font-size:22px; padding-top:14px; height:48px; background-image: url(${basePath}/resources/index/img/8_rep.png); background-repeat: repeat-x;">
                <span id="userOpt"
                ><a>${user.username}</a></span>
                |<span onclick="execLogout()"><a>注销</a></span>
            </div>
            <div style="float:left; ">
                <img src="${basePath}/resources/index/img/8_right.png">
            </div>
        </div>
    </div>

    <div class="headMenu">
        <ul class="nochange">
            <c:if test="${'admin'==user.userloginid}">
                <li>
                    <a target="_blank" href="${basePath}/identity/index.action?flag=true">
                        管理后台
                    </a>
                </li>
                <li>
                    <a target="_blank" href="${basePath}/s/uc/sdyz/i?type=ls">
                        教师站点
                    </a>
                </li>
                <li>
                    <a target="_blank" href="${basePath}/s/uc/sdyz/i?type=xs">
                        学生站点
                    </a>
                </li>
            </c:if>
            <li>
                <a target="_blank" href="${basePath}/s/uc/mh/up">
                    密码修改
                </a>
            </li>
            <li>
                <a target="_blank" href="${basePath}/s/uc/mh/hp">
                    头像上传
                </a>
            </li>
        </ul>
    </div>
</div>
<div class="content">
    <div class="container">
        <div class="line clearfix first">
            <div class="left nav">
                <div class="title">导航链接</div>
                <ul class="nochange ">
                    <c:forEach var="navLink" items="${navLinks }" begin="0" end="6">
                        <li>
                            <a target="_blank" href="${navLink.href}">
                                <span>${navLink.name}</span>
                            </a>
                        </li>
                    </c:forEach>
                    <%--<li>--%>
                        <%--<a target="_blank" href="http://211.64.79.130">--%>
                            <%--<span>行政管理</span>--%>
                        <%--</a>--%>
                    <%--</li>--%>
                    <%--<li>--%>
                        <%--<a target="_blank" href="http://211.64.79.135">--%>
                            <%--<span>教学管理</span>--%>
                        <%--</a>--%>
                    <%--</li>--%>
                    <%--<li>--%>
                        <%--<a target="_blank" href="http://211.64.79.144">--%>
                            <%--<span>学生管理</span>--%>
                        <%--</a>--%>
                    <%--</li>--%>
                    <%--<li>--%>
                        <%--<a target="_blank" href="http://211.64.79.137">--%>
                            <%--<span>科研管理</span>--%>
                        <%--</a>--%>
                    <%--</li>--%>
                    <%--<li>--%>
                        <%--<a target="_blank" href="http://211.64.79.131">--%>
                            <%--<span>财务系统</span>--%>
                        <%--</a>--%>
                    <%--</li>--%>
                    <%--<li>--%>
                        <%--<a target="_blank" href="http://211.64.79.191:8080/reader/hwthau.php">--%>
                            <%--<span>图书管理</span>--%>
                        <%--</a>--%>
                    <%--</li>--%>
                    <%--<li>--%>
                        <%--<a target="_blank" href="javascript:void(0);">--%>
                            <%--<span>考勤信息</span>--%>
                        <%--</a>--%>
                    <%--</li>--%>
                </ul>
            </div>
            <div id="notice_news" class="right news">
                <div class="title">
                    <div class="news">
                        通知公告
                    </div>
                    <div class="more">
                        <span onclick="window.open('http://www.szhvs.com/article/lists/category/164.html')">
                        更多>>
                        </span>
                    </div>
                </div>
                <table id="notices">
                </table>
            </div>
        </div>
        <div class="line clearfix second">
            <div class="left user-box">
                <div class="user">
                    <%--<img src="${basePath}/resources/index/img/6.png">--%>
                    <a target="_blank" href="${basePath}/s/uc/mh/hp">
                        <img onerror="this.src='${basePath }/userinfo/user_male_portrait.png'"
                             style="width: 80px; height:80px;" src="${basePath }/userinfo/${user.userloginid }"
                             alt="用户头像">
                    </a>
                    <div class="name">${user.username }，欢迎你！</div>
                </div>
                <div class="operate-box">
                    <div class="line">
                        <div class="left">
                            邮件
                            <c:if test="${null != unreadMailNumber && 0 != unreadMailNumber }">
								<span>
									<span style="color: red; font-size: 12px; margin: 0px -4px 0px -4px;">(${unreadMailNumber }封未读)</span>
								</span>
                            </c:if>
                        </div>
                        <div class="right">
                            <span onclick="window.open('${basePath}/s/uc/mh/hp')">
                            修改信息
                            </span>
                        </div>
                    </div>
                    <div class="line">
                        <div class="left">
                            图书到期(30天)
                        </div>
                        <div class="right">
                            <span onclick="window.open('${basePath}/s/uc/mh/up');">
                            修改密码
                                </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="right msg-box">
                <div class="title">
                    <div class="left">
                        您有
                        <span class="task">
                        <c:if test="${0 == todomessagenum}">
                            0
                        </c:if>
							<c:if test="${0 != todomessagenum}">
                                <a onclick="window.open('${basePath}/s/m/index')"
                                   style="cursor: pointer; color: red;">${null == todomessagenum?0:todomessagenum}</a>
                            </c:if>
                    </span>
                        条待办信息，请及时处理
                        <%--<span class="msg">--%>
                        <%--<c:if test="${0 == fn:length(message)}">--%>
                        <%--0--%>
                        <%--</c:if>--%>
                        <%--<c:if test="${0 != fn:length(message)}">--%>
                        <%--${fn:length(message)}--%>
                        <%--</c:if>--%>
                        <%--</span>--%>
                        <%--条信息，请及时处理--%>
                    </div>
                    <div class="right">
                        <span onclick="window.open('${basePath}/s/m/index');">
                        更多>>
                        </span>
                    </div>
                </div>
                <div class="msg-content">
                    <div class="task-box">
                        <c:forEach var="todomessage_one" items="${todomessage }" begin="0" end="4"
                                   varStatus="status_todomessage">
                            <div class="item">
                                <span class="label">待办事项</span>
                                <span class="title" onmouseover="$(this).find('span').css('color','green');"
                                      onmouseout="$(this).find('span').css('color','#646464');"
                                      onclick="window.open('${todomessage_one.url}');"><a>${todomessage_one.bt }</a></span>
                            </div>
                        </c:forEach>
                    </div>
                    <div class="msg-box">
                        <c:forEach var="tMessage" items="${message }" varStatus="status_message">
                            <c:if test="${(tipTotalIndex + status_message.index + 1) <= 6 }">
                                <div class="item">
                                    <span class="label">消息回复</span>
                                    <span class="title" onmouseover="$(this).find('span').css('color','green');"
                                          onmouseout="$(this).find('span').css('color','#646464');"
                                          onclick="window.open('${tMessage.url}');">${tMessage.title }</span>
                                </div>
                            </c:if>
                            <%--<c:if test="${(tipTotalIndex + status_message.index + 1) > 6 }">--%>
                            <%--<li onmouseover="$(this).find('span').css('color','green');" onmouseout="$(this).find('span').css('color','#646464');" onclick="window.open('${tMessage.url}');" style="display: none;">--%>
                            <%--<span>${tMessage.title }</span>--%>
                            <%--</li>--%>
                            <%--</c:if>--%>
                        </c:forEach>
                    </div>
                </div>
            </div>
        </div>
        <div class="line clearfix third">
            <div class="left plan-box">
                <div class="plan">
                    <div class="info">
                        <div class="img-box">
                            <img src="${basePath}/resources/index/img/10.png">
                        </div>
                        <div class="right">
                            <div class="title">一周安排</div>
                            <div class="extra">（有20天的日程）</div>
                        </div>
                    </div>
                    <div class="operate-box clearfix">
                        <div class="item">
                            值日表
                        </div>
                        <div class="item">
                            通讯录
                        </div>
                    </div>
                </div>
                <div class="schedule">
                    <div class="info">
                        <div class="img-box">
                            <img src="${basePath}/resources/index/img/1.png">
                        </div>
                        <div class="right">
                            <div class="title">教师课表</div>
                        </div>
                    </div>
                    <div class="operate-box clearfix">
                        <div class="item">
                            校历
                        </div>
                        <div class="item">
                            作息时间
                        </div>
                    </div>
                </div>
            </div>
            <div class="right models-box">
                <div class="toptitle">
                </div>
                <div>
                    <div class="models clearfix">
                        <c:forEach var="menu" items="${mrfw }" varStatus="status_menu" begin="0" end="5">
                            <div class="item">
                                <img src="${basePath}/resources/images/icons/orange/${menu.tb}"
                                     onerror="this.src='${basePath}/resources/images/icons/orange/icon-01.png'"
                                     onclick="window.open('${menu.menupath}')">
                                <div class="title">${menu.menuname }</div>
                            </div>
                        </c:forEach>
                        <%--<div class="item">--%>
                        <%--<img src="${basePath}/resources/index/img/11.png">--%>
                        <%--<div class="title">流程委托</div>--%>
                        <%--</div>--%>
                        <%--<div class="item">--%>
                        <%--<img src="${basePath}/resources/index/img/3.png">--%>
                        <%--<div class="title">办公系统</div>--%>
                        <%--</div>--%>
                        <%--<div class="item">--%>
                        <%--<img src="${basePath}/resources/index/img/4.png">--%>
                        <%--<div class="title">一周安排历史记录</div>--%>
                        <%--</div>--%>
                        <%--<div class="item">--%>
                        <%--<img src="${basePath}/resources/index/img/2.png">--%>
                        <%--<div class="title">问题反馈</div>--%>
                        <%--</div>--%>
                        <%--<div class="item">--%>
                        <%--<img src="${basePath}/resources/index/img/13.png">--%>
                        <%--<div class="title">学生请假情况</div>--%>
                        <%--</div>--%>
                        <%--<div class="item">--%>
                        <%--<img src="${basePath}/resources/index/img/12.png">--%>
                        <%--<div class="title">奖学金获取情况</div>--%>
                        <%--</div>--%>
                    </div>
                    <div class="extra">
                        <div class="more" data-toggle="modal" data-target="#myModal">更多</div>
                        <div class="subscribe" onclick="window.open('${basePath}/s/uc/se/i/${mrfwid}')">订阅</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="border"></div>
<div class="footer">
    <div class="container clearfix">
        <div class="info">
            <div>
                <span>地址：苏州市高新区塔园路68号</span>
                <span>邮编：215009</span>
                <span>电话：0512-68242338</span>
                <span>信箱：xxc@mail.szhvs.com</span>
            </div>
            <div>
                <span>招生咨询热线：0512-68254317</span>
                <span>©2015 苏州高等职业技术学校 版权所有 苏ICP备10210956号</span>
            </div>
        </div>
        <div class="icon">
            <img src="${basePath}/resources/index/img/14.png">
        </div>
    </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">已订阅服务</h4>
            </div>
            <div class="modal-body">
                <c:forEach var="menu" items="${mrfw }" varStatus="status_menu">
                    <div style="float:left; width:131px">
                        <img src="${basePath}/resources/images/icons/orange/${menu.tb}"
                             onerror="this.src='${basePath}/resources/images/icons/orange/icon-01.png'"
                             onclick="window.open('${menu.menupath}')">
                        <div class="title">${menu.menuname }</div>
                    </div>
                </c:forEach>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</body>
</html>
